import { exec, GLib, monitorFile } from "astal";
import { App } from "astal/gtk4";

export function monitorColorsChange() {
  const monitorList = [
    `${GLib.getenv("HOME")}/.config/ags/style/bar.scss`,
    `${GLib.getenv("HOME")}/.config/ags/style/main.scss`,
  ];
  monitorList.forEach((file) => {
    monitorFile(file, () => {
      const target = "/tmp/astal/style.css";
      exec(`sass ${GLib.getenv("HOME")}/.config/ags/style/main.scss ${target}`);
      App.reset_css;
      App.apply_css(target, true);
    });
  });
}
